fix(strategy): expose --spectral-alpha for the decaying-spectrum fill#232
Conversation
storage.generate takes a spectral_alpha knob (the k^-alpha singular-value decay for --fill decaying-spectrum), but the strategy CLI had no flag for it and runner.run/compare didn't thread it through, so every decaying-spectrum run was hardcoded to alpha=1.0 -- the only generate() parameter with no CLI path. Now that decaying-spectrum is a scored track (floor 0.90), contributors need to sweep the decay rate to see where a transform holds vs. degrades. Add --spectral-alpha (float, default 1.0, >= 0; negatives grow the tail and are rejected at the CLI boundary like --n/--data-rank) and thread it through runner.run/compare into storage.generate. End-to-end (N=512, M=48): --spectral-alpha 0.5 -> rel_err 0.70; 3.0 -> rel_err 0.004. Adds CLI-validation and pure-NumPy plumbing/effect tests. Fixes zeokin#231
|
Thanks @ultrahighsuper — this is a real fix and CI is green, but it now conflicts with |
# Conflicts: # strategy/cli.py # tests/test_cli_errors.py
|
This PR currently has merge conflicts with the base branch. Please resolve them within 12 hours or the bot will close the PR automatically. |
zeokin
left a comment
There was a problem hiding this comment.
Request changes before merge.
- Rebase onto current main; strategy/cli.py and tests/test_cli_errors.py changed in the merged fix batch.
- Reject non-finite --spectral-alpha values. The current
args.spectral_alpha < 0guard lets NaN and +inf through; use a finite-value check and add regression cases for NaN, +inf, and -inf that exit cleanly before backend/matrix work.
The CLI plumbing is otherwise useful, but this public numeric input must not be able to poison decaying-spectrum generation.
# Conflicts: # strategy/cli.py
PR kind
Summary
storage.generatetakes aspectral_alphaknob (thek^-alphasingular-value decay for--fill decaying-spectrum), but the strategy CLI had no flag for it andrunner.run/runner.comparedidn't thread it through — so every decaying-spectrum run was hardcoded toalpha=1.0. It was the onlygenerate()parameter with no CLI path. Now that decaying-spectrum is a scored track (floor 0.90), contributors need to sweep the decay rate to see where a transform holds up vs. degrades.This adds
--spectral-alpha(float, default 1.0,>= 0; negatives grow the tail — not a decaying spectrum — and are rejected at the CLI boundary like--n/--data-rank) and threads it throughrunner.run/compareintostorage.generate.Fixes #231. Distinct from #229 (which only corrects the
--data-rankhelp text).Effect (GPU end-to-end, N=512, decaying-spectrum, M=48)
Steeper alpha packs more energy into the leading components, so the subspace method reconstructs it far better — exactly the axis this fill is meant to probe.
Validation (CPU-safe path)
The 2 failures pre-exist on clean
mainand are environment-only (Windows path-separator assertion ineval/tests/test_gpu_batch.py; fp16 in-core/tiled parity on a GTX 1650). New tests: negative--spectral-alphaexits cleanly (rc 2), the flag is parsed with default 1.0, and a larger alpha provably steepens the singular-value decay (pure NumPy).Scope
strategy/cli.py+strategy/runner.py+ tests only; open (non-protected) zone. Pure plumbing of an existing-but-unreachable knob; no behavior change at the defaultalpha=1.0.